cmake_minimum_required(VERSION 3.6)

project(croncpp)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")

include_directories(./include)
set(INSTALL_HEAD_FILES 
    include/croncpp/Cron.h
    include/croncpp/CronClock.h
    include/croncpp/CronData.h
    include/croncpp/CronRandomization.h
    include/croncpp/CronSchedule.h
    include/croncpp/DateTime.h
    include/croncpp/Task.h
    include/croncpp/TaskQueue.h
    include/croncpp/TimeTypes.h
)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/out)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

add_library(croncpp_static     
    src/CronClock.cpp
    src/CronData.cpp
    src/CronRandomization.cpp
    src/CronSchedule.cpp
    src/Task.cpp
)
add_library(croncpp 
    src/CronClock.cpp
    src/CronData.cpp
	src/CronRandomization.cpp
	src/CronSchedule.cpp
	src/Task.cpp
)

target_include_directories(${PROJECT_NAME} PRIVATE /usr/local/include/date/include PUBLIC include)

install (FILES ${INSTALL_HEAD_FILES} DESTINATION include/croncpp)
install (TARGETS croncpp croncpp_static
    ARCHIVE DESTINATION lib # 设置动态库安装路径
    LIBRARY DESTINATION /usr/lib # 设置静态库安装路径
)